package Algorithm;

//基础题：打印各种三角形
public class printTriangle {
    public static void main(String[] args) {
        function(5);
    }

    public static void function(int level) {
        //控制总的行数
        for (int i = 1; i < level; i++) {
            for (int j = level - i; j >= 0; j--) {
                System.out.print(" ");
            }
            for (int k = 1; k <= 2 * i - 1; k++) {
                System.out.print("*");
            }
            //没过一次大循环就换行
            System.out.println("");
        }
    }
}


